package com.woniuxy.mapper;

import com.woniuxy.entity.User;
import com.woniuxy.entity.UserExample;

import java.util.List;
import java.util.Map;

import com.woniuxy.vo.UserVO;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/*
@author Jan
@create 2020-05-20 19:00

*/
public interface UserMapper {
    long countByExample(UserExample example);

    int deleteByExample(UserExample example);

    int deleteByPrimaryKey(Integer userId);

    int insert(User record);

    int insertSelective(User record);

    List<User> selectByExample(UserExample example);

    User selectByPrimaryKey(Integer userId);

    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    @Select("select " +
            "u.user_id userId,u.username,a.camp_id campId,c.campname,u.img_url face" +
            " from appointment a " +
            "inner join user u on u.user_id = a.user_id " +
            "inner join camp c on c.camp_id = a.camp_id " +
            "where a.user_id = #{userId} and a.status in (3,2,1)")
    List<Map<String, Object>> selectUserNowCampOrCity(int userId);
    //通过用户名或电话查询用户信息
    UserVO selectUserByUserNameOrPassword(String userName);
    //查询电话是否已存在
    String selectTel(String tel);
    //根据userId更新账户余额
    int updateUserAccount(Map<String, Object> map);
}